//go:build wireinject

package main

import (
	repository2 "booksmart/book/interactive/repository"
	cache2 "booksmart/book/interactive/repository/cache"
	dao2 "booksmart/book/interactive/repository/dao"
	service2 "booksmart/book/interactive/service"
	"booksmart/book/internal/repository"
	"booksmart/book/internal/repository/article"
	"booksmart/book/internal/repository/cache"
	"booksmart/book/internal/repository/dao"
	articleDao "booksmart/book/internal/repository/dao/article"
	"booksmart/book/internal/service"
	"booksmart/book/internal/web"
	ioc2 "booksmart/book/ioc"
	"github.com/gin-gonic/gin"
	"github.com/google/wire"
)

var interactiveSvcProvider = wire.NewSet(
	service2.NewInteractiveService,
	repository2.NewInteractiveRepository,
	cache2.NewRedisInteractiveCache,
	dao2.NewGROMInteractiveDAO,
)

var nacosProvider = wire.NewSet(
	ioc2.InitNacosClient,
	ioc2.InitNacosBuilder,
	ioc2.InitIntrGRPCClientByNacos,
)

func InitWebServers() *gin.Engine {
	wire.Build(
		ioc2.InitLogger,
		ioc2.InitDB, ioc2.InitRedis,
		dao.NewUserDao, articleDao.NewGORMArticleDAO,
		cache.NewUserCache, cache.NewCodeCache,
		repository.NewUserRepository, repository.NewCodeRepository, article.NewArticleRepository,

		service.NewUserService, service.NewCodeService, service.NewArticleService,

		web.NewUserHandler, web.NewArticleHandler,
		ioc2.InitSmsService,
		ioc2.InitGin,
		ioc2.InitMiddlewares,

		//interactiveSvcProvider,
		//ioc2.InitIntrGRPCClient,
		nacosProvider,
	)

	return new(gin.Engine)
}
